package com.sykj.qiaoli.controller;

import com.sykj.qiaoli.bean.casea.Law;
import com.sykj.qiaoli.service.LawService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * @program: lawfirm
 * @description: 案件信息
 * @author: qiaoli
 * @create: 2020-05-15 15:20
 */
@RestController
@RequestMapping("/Law")
public class LawController {
    @Autowired
    LawService lawService;
    @RequestMapping("/queryByid/{lawId}")
    public Law  queryByid(@PathVariable("lawId") Integer lawId){
        return  lawService.queryByid(lawId);
    }
    @RequestMapping("/queryAll")
    public List<Law> queryAll(@RequestParam(value = "lawId",required = false)String lawId,
    @RequestParam(value = "ApproveStatus",required = false)String   ApproveStatus,
    @RequestParam(value = "caseSubmitter",required = false)String   caseSubmitter,
    @RequestParam(value = "CaseTypeId",required = false)String   CaseTypeId,
    @RequestParam(value = "caseSubtimeStart",required = false)String   caseSubtimeStart,
     @RequestParam(value = "caseSubtimeEnd",required = false)String   caseSubtimeEnd){
        Map<String ,Object> map=new HashMap<>();
        map.put("lawId",lawId);
        map.put("ApproveStatus",ApproveStatus);
        map.put("caseSubmitter",caseSubmitter);
        map.put("CaseTypeId",CaseTypeId);
        map.put("caseSubtimeStart",caseSubtimeStart);
        map.put("caseSubtimeEnd",caseSubtimeEnd);
        return lawService.queryAll(map);
    }

    public boolean  updateBystatus(@RequestParam(value ="Status",required =false)String Status,
                                   @RequestParam(value ="array",required =false)Integer[] array){
Map<String,Object> map=new HashMap<>();
        map.put("Status",Status);
        map.put("array",array);
        return lawService.updataBystatus(map);
    }
}
